load(
    "//bazel:envoy_build_system.bzl",
    "envoy_cc_mock",
    "envoy_cc_test",
    "envoy_cc_test_library",
    "envoy_package",
)

licenses(["notice"])  # Apache 2

envoy_package()

envoy_cc_mock(
    name = "redis_mocks",
    srcs = ["mocks.cc"],
    hdrs = ["mocks.h"],
    deps = [
        "//source/common/common:assert_lib",
        "//source/extensions/filters/network/common/redis:client_lib",
        "//source/extensions/filters/network/common/redis:codec_lib",
        "//test/test_common:printers_lib",
    ],
)

envoy_cc_test_library(
    name = "test_utils_lib",
    hdrs = ["test_utils.h"],
    deps = [
        "//source/common/protobuf:utility_lib",
        "@envoy_api//envoy/extensions/filters/network/redis_proxy/v3:pkg_cc_proto",
    ],
)

envoy_cc_test(
    name = "codec_impl_test",
    srcs = ["codec_impl_test.cc"],
    rbe_pool = "6gig",
    deps = [
        ":redis_mocks",
        "//source/common/buffer:buffer_lib",
        "//source/common/common:assert_lib",
        "//source/extensions/filters/network/common/redis:codec_lib",
        "//test/test_common:utility_lib",
    ],
)

envoy_cc_test(
    name = "client_impl_test",
    srcs = ["client_impl_test.cc"],
    rbe_pool = "6gig",
    deps = [
        ":redis_mocks",
        ":test_utils_lib",
        "//source/common/event:dispatcher_lib",
        "//source/common/network:utility_lib",
        "//source/common/upstream:upstream_includes",
        "//source/common/upstream:upstream_lib",
        "//source/extensions/filters/network/common/redis:client_lib",
        "//test/mocks/network:network_mocks",
        "//test/mocks/thread_local:thread_local_mocks",
        "//test/mocks/upstream:host_mocks",
        "//test/test_common:simulated_time_system_lib",
        "@envoy_api//envoy/extensions/filters/network/redis_proxy/v3:pkg_cc_proto",
    ],
)

envoy_cc_test(
    name = "fault_test",
    srcs = ["fault_test.cc"],
    rbe_pool = "6gig",
    deps = [
        ":redis_mocks",
        "//source/common/common:assert_lib",
        "//source/extensions/filters/network/common/redis:fault_lib",
        "//test/mocks/runtime:runtime_mocks",
        "//test/test_common:test_runtime_lib",
        "//test/test_common:utility_lib",
    ],
)
